Skip to content

Add STB and FileWatcher as Git submodules#21

Open
1234-ad wants to merge 3 commits intoCGS-IITKGP:mainfrom
1234-ad:fix/add-stb-filewatcher-submodules
Open

Add STB and FileWatcher as Git submodules#21
1234-ad wants to merge 3 commits intoCGS-IITKGP:mainfrom
1234-ad:fix/add-stb-filewatcher-submodules

Conversation

@1234-ad
Copy link
Copy Markdown

@1234-ad 1234-ad commented Jan 8, 2026

Description

This PR addresses issue #17 by converting STB and FileWatcher from direct file inclusion to proper Git submodules, ensuring consistent dependency management across all external libraries.

Changes Made

1. Updated .gitmodules

  • Added external/stb submodule pointing to https://github.com/nothings/stb.git
  • Added external/filewatch submodule pointing to https://github.com/ThomasMonkman/filewatch.git

2. Updated CMakeLists.txt

  • Added external/stb to include directories
  • Added external/filewatch to include directories
  • Ensures proper header resolution from submodule locations

3. Added Migration Documentation

  • Created SUBMODULE_MIGRATION.md with detailed migration steps
  • Includes instructions for both existing and new users
  • Documents benefits and rationale

Benefits

Consistency: All external dependencies now managed uniformly as Git submodules
Version Control: Can track and pin specific versions of STB and FileWatcher
Maintainability: Easier to update dependencies to newer versions
Repository Size: Reduces duplication of large header files in the main repo

Migration Path

For existing users, the migration is straightforward:

  1. Remove old standalone files (external/FileWatch.hpp and src/stb_image.h)
  2. Run git submodule update --init --recursive
  3. Rebuild the project

Detailed instructions are provided in SUBMODULE_MIGRATION.md.

Testing Checklist

  • Verify submodules are properly initialized
  • Confirm CMake configuration succeeds
  • Test compilation on Linux
  • Test compilation on macOS
  • Test compilation on Windows
  • Verify hot-reloading still works with FileWatcher submodule
  • Verify STB image loading functionality

Related Issues

Fixes #17

Notes

  • The old external/FileWatch.hpp and src/stb_image.h files should be removed after this PR is merged
  • Users will need to run git submodule update --init --recursive after pulling these changes
  • This change maintains backward compatibility with existing code - only the dependency management approach changes

Future Considerations

This PR sets the foundation for adding Bullet Physics as a submodule (mentioned in issue #17), maintaining consistency across all external dependencies.

- Add stb as submodule from nothings/stb repository
- Add FileWatcher as submodule from ThomasMonkman/filewatch repository
- Ensures consistent dependency management across all external libraries
- Fixes issue CGS-IITKGP#17
- Add external/stb to include directories for stb_image.h
- Add external/filewatch to include directories for FileWatch.hpp
- Ensures proper header resolution from submodules
- Part of fix for issue CGS-IITKGP#17
- Document changes made in this PR
- Provide step-by-step migration instructions for existing users
- Explain benefits of submodule approach
- Part of fix for issue CGS-IITKGP#17
Copy link
Copy Markdown
Contributor

@Zone-Infinity Zone-Infinity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good except the part where you have to update every files includes for the stb and filewatch.
Also can you verify whatever is in the checklist and mark them accordingly?

Comment thread SUBMODULE_MIGRATION.md
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea you don't have to do this, just delete the files and let that be in the PR.
Before commiting that, check if it works (you have to also change each file for the imports/includes)

Comment thread .gitmodules
[submodule "external/stb"]
path = external/stb
url = https://github.com/nothings/stb.git
branch = master
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont think the branch is necessary
but it can stay ig

Comment thread .gitmodules
[submodule "external/filewatch"]
path = external/filewatch
url = https://github.com/ThomasMonkman/filewatch.git
branch = master
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

STB & FileWatcher Not Added as Submodules

2 participants